
package com.borqs.music.tasks;

import static com.borqs.music.http.RequestMethod.GET;
import static com.borqs.music.util.MusicConf.ReqParam.KEYWORDS;
import static com.borqs.music.util.MusicConf.ReqParam.COUNT;
import static com.borqs.music.util.MusicConf.ReqParam.PAGE;
import static com.borqs.music.util.MusicConf.ReqType.MUSIC_SEARCH_SONG;

import java.util.HashMap;
import java.util.Map;

import com.borqs.music.executor.TaskListener;
import com.borqs.music.http.HttpRequest;
import com.borqs.music.util.MusicConf;

public class SearchSongsTask extends SongTask {
    private String mKeywords;
    private String mTicket;
    private int mPage;

    public SearchSongsTask(TaskListener listener, String ticket, String keywords, int page) {
        super(listener, false);
        mKeywords = keywords;
        mTicket = ticket;
        mPage = page;
    }

    @Override
    public HttpRequest prepareRequest() {
        Map<String, String> params = new HashMap<String, String>();
        params.put(KEYWORDS, mKeywords);
        params.put(PAGE, String.valueOf(mPage));
        params.put(COUNT, String.valueOf(PAGE_COUNT));

        final String URL_SEARCH = MusicConf.getUrl(MUSIC_SEARCH_SONG);
        HttpRequest req = new HttpRequest(GET, URL_SEARCH, mTicket, params);
        return req;
    }

}
